package org.jground.rx.def.apps.legal;
import org.jground.rx.*;
import org.jground.rx.gen.*;
import org.jground.util.*;
import java.util.List;
import org.jground.rx.def.apps.accounting.*;
import org.jground.rx.def.apps.commons.*;
import org.jground.rx.def.apps.knowledge.*;
import org.jground.rx.def.*;
import org.jground.rx.def.apps.crm.*;
import org.jground.rx.def.apps.cip.*;
import org.jground.rx.def.apps.core.*;
import org.jground.rx.def.apps.ipm.*;
@SuppressWarnings("unused")
public class Contract extends GenRoot {

    public static final String moid = "org.jground.rx.def.apps.legal.Contract";

    private static final String contractTitle ="contractTitle";
    private static final String contractNumber ="contractNumber";
    private static final String counterparty ="counterparty";
    private static final String contractAddress ="contractAddress";
    private static final String contractStartDate ="contractStartDate";
    private static final String contractEndDate ="contractEndDate";
    private static final String correspondenceAddress ="correspondenceAddress";
    private static final String contactPerson ="contactPerson";
    private static final String products ="products";
    private static final String followupContract ="followupContract";
    private static final String automaticRenewal ="automaticRenewal";
    private static final String automaticRenewalDeadline ="automaticRenewalDeadline";
    private static final String usageOfRights ="usageOfRights";
    private static final String applicableLaw ="applicableLaw";
    private static final String placeOfJuristiction ="placeOfJuristiction";
    private static final String contractStatus ="contractStatus";
    private static final String documents ="documents";
    private static final String $CREATOR ="$CREATOR";

    public static final class AttName {
        public static final String contractTitle ="contractTitle";
        public static final String contractNumber ="contractNumber";
        public static final String counterparty ="counterparty";
        public static final String contractAddress ="contractAddress";
        public static final String contractStartDate ="contractStartDate";
        public static final String contractEndDate ="contractEndDate";
        public static final String correspondenceAddress ="correspondenceAddress";
        public static final String contactPerson ="contactPerson";
        public static final String products ="products";
        public static final String followupContract ="followupContract";
        public static final String automaticRenewal ="automaticRenewal";
        public static final String automaticRenewalDeadline ="automaticRenewalDeadline";
        public static final String usageOfRights ="usageOfRights";
        public static final String applicableLaw ="applicableLaw";
        public static final String placeOfJuristiction ="placeOfJuristiction";
        public static final String contractStatus ="contractStatus";
        public static final String documents ="documents";
        public static final String $CREATOR ="$CREATOR";
    }

    public static Contract createNew() { return new Contract(RXObjectService.getInstance().create(moid)); }

    public static Contract getById(String oid) { 
        IRXObject mod = RXObjectService.getInstance().getById(oid);
        if(mod == null) { return null; }
        return new Contract(mod);
    }

    public static Contract[] getByIds(String... oids) { 
        List<IRXObject> mods = RXObjectService.getInstance().getByIds(moid, oids);
        Contract[] res = new Contract[mods.size()];
        int i = 0;
        for(IRXObject mod : mods) {
            res[i] = new Contract(mod);
            i++;
        }
        return res;
    }

    public static SearchCriteria newSearchCriteria() {
        return  SearchCriteria.create(moid);
    }

    public static Contract[] search(SearchCriteria sc) {
        return  wrap(GenRoot._search(sc));
    }

    public static Contract[] wrap(List<? extends IRXObjectSynopsis> mods) { 
        Contract[] res = new Contract[mods.size()];
        int i = 0;
        for(IRXObjectSynopsis mod : mods) {
            res[i] = new Contract(mod);
            i++;
        }
        return res;
    }

    public static Contract wrap(IRXObjectSynopsis mod) { 
        return new Contract(mod);
    }

    private Contract(IRXObjectSynopsis rxObject) {this.rxObject = (IRXObject) rxObject;}

    public static String getContractTitleLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractTitle).getLabel();
    }

    public static String getContractTitleDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractTitle).getDescription();
    }

    public void setContractTitle(String string) {
        rxObject.set(contractTitle, _to_String(string));
    }

    public String getContractTitle() {
        return _to_String(rxObject.getCurrentValue(contractTitle));
    }

    public static String getContractNumberLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractNumber).getLabel();
    }

    public static String getContractNumberDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractNumber).getDescription();
    }

    public void setContractNumber(String string) {
        rxObject.set(contractNumber, _to_String(string));
    }

    public String getContractNumber() {
        return _to_String(rxObject.getCurrentValue(contractNumber));
    }

    public static String getCounterpartyLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, counterparty).getLabel();
    }

    public static String getCounterpartyDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, counterparty).getDescription();
    }

    public void addCounterparty(org.jground.rx.def.apps.core.LegalEntity... value) {
        rxObject.set(counterparty, _to_String(value));
    }

    public void setCounterparty(org.jground.rx.def.apps.core.LegalEntity[] values) {
        rxObject.set(counterparty, _to_String(values));
    }

    public int getCounterpartySize() {
        return StringUtils.rnn(rxObject.getValues(counterparty)).length;
    }

    public org.jground.rx.def.apps.core.LegalEntity[] getCounterparty() {
        return org.jground.rx.def.apps.core.LegalEntity.getByIds(rxObject.getValues(counterparty));
    }

    public org.jground.rx.def.apps.core.LegalEntity getCounterparty(int index) {
        return org.jground.rx.def.apps.core.LegalEntity.getByIds(rxObject.getValues(counterparty))[index];
    }

    public static String getContractAddressLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractAddress).getLabel();
    }

    public static String getContractAddressDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractAddress).getDescription();
    }

    public org.jground.rx.def.apps.core.Address getContractAddress() {
        return ArrayUtils.first(org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.contractAddress)));
    }

    public org.jground.rx.def.apps.core.Address createContractAddress() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.newComponent(contractAddress));
    }

    public void setContractAddress(org.jground.rx.def.apps.core.Address value) {
        rxObject.set(contractAddress, value.getOidString());
    }

    public static String getContractStartDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractStartDate).getLabel();
    }

    public static String getContractStartDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractStartDate).getDescription();
    }

    public void setContractStartDate(String dateValue) {
        rxObject.set(contractStartDate, _to_String(dateValue));
    }

    public String getContractStartDate() {
        return _to_String(rxObject.getCurrentValue(contractStartDate));
    }

    public static String getContractEndDateLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractEndDate).getLabel();
    }

    public static String getContractEndDateDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractEndDate).getDescription();
    }

    public void setContractEndDate(String dateValue) {
        rxObject.set(contractEndDate, _to_String(dateValue));
    }

    public String getContractEndDate() {
        return _to_String(rxObject.getCurrentValue(contractEndDate));
    }

    public static String getCorrespondenceAddressLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, correspondenceAddress).getLabel();
    }

    public static String getCorrespondenceAddressDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, correspondenceAddress).getDescription();
    }

    public org.jground.rx.def.apps.core.Address getCorrespondenceAddress() {
        return ArrayUtils.first(org.jground.rx.def.apps.core.Address.wrap(rxObject.getComponents(AttName.correspondenceAddress)));
    }

    public org.jground.rx.def.apps.core.Address createCorrespondenceAddress() {
        return org.jground.rx.def.apps.core.Address.wrap(rxObject.newComponent(correspondenceAddress));
    }

    public void setCorrespondenceAddress(org.jground.rx.def.apps.core.Address value) {
        rxObject.set(correspondenceAddress, value.getOidString());
    }

    public static String getContactPersonLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contactPerson).getLabel();
    }

    public static String getContactPersonDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contactPerson).getDescription();
    }

    public void setContactPerson(String text) {
        rxObject.set(contactPerson, _to_String(text));
    }

    public String getContactPerson() {
        return _to_String(rxObject.getCurrentValue(contactPerson));
    }

    public static String getProductsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, products).getLabel();
    }

    public static String getProductsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, products).getDescription();
    }

    public void addProducts(org.jground.rx.def.apps.cip.Product... value) {
        rxObject.set(products, _to_String(value));
    }

    public void setProducts(org.jground.rx.def.apps.cip.Product[] values) {
        rxObject.set(products, _to_String(values));
    }

    public int getProductsSize() {
        return StringUtils.rnn(rxObject.getValues(products)).length;
    }

    public org.jground.rx.def.apps.cip.Product[] getProducts() {
        return org.jground.rx.def.apps.cip.Product.getByIds(rxObject.getValues(products));
    }

    public org.jground.rx.def.apps.cip.Product getProducts(int index) {
        return org.jground.rx.def.apps.cip.Product.getByIds(rxObject.getValues(products))[index];
    }

    public static String getFollowupContractLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, followupContract).getLabel();
    }

    public static String getFollowupContractDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, followupContract).getDescription();
    }

    public void setFollowupContract(org.jground.rx.def.apps.legal.Contract value) {
        rxObject.set(followupContract, _to_String(value));
    }

    public org.jground.rx.def.apps.legal.Contract getFollowupContract() {
        return org.jground.rx.def.apps.legal.Contract.getById(rxObject.getCurrentValue(followupContract));
    }

    public static String getAutomaticRenewalLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, automaticRenewal).getLabel();
    }

    public static String getAutomaticRenewalDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, automaticRenewal).getDescription();
    }

    public void setAutomaticRenewal(Boolean booleanValue) {
        rxObject.set(automaticRenewal, _to_String(booleanValue));
    }

    public Boolean getAutomaticRenewal() {
        return _to_Boolean(rxObject.getCurrentValue(automaticRenewal));
    }

    public static String getAutomaticRenewalDeadlineLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, automaticRenewalDeadline).getLabel();
    }

    public static String getAutomaticRenewalDeadlineDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, automaticRenewalDeadline).getDescription();
    }

    public void setAutomaticRenewalDeadline(String dateValue) {
        rxObject.set(automaticRenewalDeadline, _to_String(dateValue));
    }

    public String getAutomaticRenewalDeadline() {
        return _to_String(rxObject.getCurrentValue(automaticRenewalDeadline));
    }

    public static String getUsageOfRightsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, usageOfRights).getLabel();
    }

    public static String getUsageOfRightsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, usageOfRights).getDescription();
    }

    public void setUsageOfRights(String text) {
        rxObject.set(usageOfRights, _to_String(text));
    }

    public String getUsageOfRights() {
        return _to_String(rxObject.getCurrentValue(usageOfRights));
    }

    public static String getApplicableLawLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, applicableLaw).getLabel();
    }

    public static String getApplicableLawDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, applicableLaw).getDescription();
    }

    public void setApplicableLaw(String string) {
        rxObject.set(applicableLaw, _to_String(string));
    }

    public String getApplicableLaw() {
        return _to_String(rxObject.getCurrentValue(applicableLaw));
    }

    public static String getPlaceOfJuristictionLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, placeOfJuristiction).getLabel();
    }

    public static String getPlaceOfJuristictionDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, placeOfJuristiction).getDescription();
    }

    public void setPlaceOfJuristiction(String string) {
        rxObject.set(placeOfJuristiction, _to_String(string));
    }

    public String getPlaceOfJuristiction() {
        return _to_String(rxObject.getCurrentValue(placeOfJuristiction));
    }

    public static String getContractStatusLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractStatus).getLabel();
    }

    public static String getContractStatusDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, contractStatus).getDescription();
    }

    public void setContractStatus(String codeValue) {
        rxObject.set(contractStatus, _to_String(codeValue));
    }

    public String getContractStatus() {
        return _to_String(rxObject.getCurrentValue(contractStatus));
    }

    public static String getDocumentsLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getLabel();
    }

    public static String getDocumentsDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, documents).getDescription();
    }

    public int getDocumentsSize() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents)).length;
    }

    public org.jground.rx.def.apps.commons.Document[] getDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents));
    }

    public org.jground.rx.def.apps.commons.Document getDocuments(int index) {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.getComponents(AttName.documents))[index];
    }

    public org.jground.rx.def.apps.commons.Document createDocuments() {
        return org.jground.rx.def.apps.commons.Document.wrap(rxObject.newComponent(documents));
    }

    public void setDocuments(org.jground.rx.def.apps.commons.Document[] values) {
        rxObject.set(documents, _to_String(documents));
    }

    public void addDocuments(org.jground.rx.def.apps.commons.Document value) {
        rxObject.add(documents, value.getOidString());
    }

    public static String get$CREATORLabel() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getLabel();
    }

    public static String get$CREATORDescription() {
        return RXSystem.getInstance().getRxService().getRXAttribute(moid, $CREATOR).getDescription();
    }

    public void set$CREATOR(String string) {
        rxObject.set($CREATOR, _to_String(string));
    }

    public String get$CREATOR() {
        return _to_String(rxObject.getCurrentValue($CREATOR));
    }

}
